/*    */ package com.zimbra.cs.service.mail;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.common.soap.MailConstants;
/*    */ import com.zimbra.cs.mailbox.Comment;
/*    */ import com.zimbra.cs.mailbox.Mailbox;
/*    */ import com.zimbra.cs.mailbox.OperationContext;
/*    */ import com.zimbra.cs.service.util.ItemId;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class AddComment
/*    */   extends MailDocumentHandler
/*    */ {
/* 32 */   private static final String[] PARENT_ID_PATH = { "comment", "parentId" };
/*    */   
/*    */   protected String[] getProxiedIdPath(Element request) {
/* 35 */     return PARENT_ID_PATH;
/*    */   }
/*    */   
/*    */   public Element handle(Element request, Map<String, Object> context) throws ServiceException {
/* 39 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/* 40 */     Mailbox mbox = getRequestedMailbox(zsc);
/* 41 */     OperationContext octxt = getOperationContext(zsc, context);
/* 42 */     String creator = zsc.getAuthtokenAccountId();
/*    */     
/* 44 */     Element c = request.getElement("comment");
/* 45 */     String itemId = c.getAttribute("parentId");
/* 46 */     String text = c.getAttribute("text");
/*    */     
/* 48 */     ItemId iid = new ItemId(itemId, zsc);
/* 49 */     Comment comment = mbox.createComment(octxt, iid.getId(), text, creator);
/*    */     
/* 51 */     Element response = zsc.createElement(MailConstants.ADD_COMMENT_RESPONSE);
/* 52 */     response.addElement("comment").addAttribute("id", comment.getId());
/* 53 */     return response;
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/mail/AddComment.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */